package org.telegram.bot.emums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author: wyx
 * @Date: 2023/5/28 0:04
 */
@Getter
@AllArgsConstructor
public enum BotExceptionEnums {

    TOKEN_ERROR("Error removing old webhook", "token不正确。")
    ,ONLY_ONE("make sure that only one bot instance is running","已存在相同机器人。")
    ,BAN_SELF("Bad Request: can't remove chat owner","该用户是群组管理员，无法执行此操作。")
    ,KEYBOARD_URL("inline keyboard button URL","按钮网址不正确，请检查后再试")
    ;


    /**
     * 类型
     */
    private final String msg;
    /**
     * 类型的标识
     */
    private final String explain;
    
    //根据msg查询explain
    public static String getExplain(String msg){
        for (BotExceptionEnums botExceptionEnums : BotExceptionEnums.values()) {
            if(msg.contains(botExceptionEnums.msg)){
                return botExceptionEnums.explain;
            }
        }
        return msg;
    }
}
